//
//  HKURLResponse.h
//  HKNetService
//
//  Created by 胡锦涛 on 2018/6/12.
//  Copyright © 2018年 胡锦涛. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HKNetWorkConfig.h"

@interface HKURLResponse : NSObject
@property (nonatomic, assign, readonly) HKResponseStatus status;
@property (nonatomic, assign, readonly) NSInteger requestId;
@property (nonatomic, copy)             NSDictionary *requestParams;//参数
@property (nonatomic, strong, readonly) NSURLSessionDataTask *task;
@property (nonatomic, copy, readonly)   id responseData;//JSON解析之后的数据
@property (nonatomic, copy, readonly)   id result;//result数据
@property (nonatomic, assign, readonly) BOOL isCache;

/*
 * 成功
 */
- (instancetype)initWithSessionDataTask:(NSURLSessionDataTask *)task requestParams:(NSDictionary *)requestParams responseData:(id)responseData status:(HKResponseStatus)status;
/*
 * error
 */
- (instancetype)initWithSessionDataTask:(NSURLSessionDataTask *)task requestParams:(NSDictionary *)requestParams responseData:(id)responseData error:(NSError *)error;

// 使用initWithData的response，它的isCache是YES，上面两个函数生成的response的isCache是NO
- (instancetype)initWithData:(NSData *)data;
@end
